package business;

import model.User;
import model.beans.UsuarioBean;

import java.util.ArrayList;
import java.util.Map;

public class Usuario {
	public static int SESSIONNOVALIDA = 0;
	public static int ACADEMIANOVALIDA = 1;
	public static int SESSIONVALIDA = 2;
	
	public static UsuarioBean usuarioValido( String str_login, String str_password ){
		UsuarioBean ub_retVal;
		User usr = new User( str_login, str_password);
		ub_retVal = usr.validating();
		return ub_retVal;
	}
  
	public static int validarSession(UsuarioBean user_log){
		int int_retVal = SESSIONNOVALIDA;
		if( user_log != null ){
			if(user_log.getAcademia() != null)int_retVal = SESSIONVALIDA;
			else int_retVal = ACADEMIANOVALIDA;
		}
		return int_retVal;
	}
	
	public static ArrayList buscar(Map map_search, String str_academia){
		ArrayList arrL_retVal = new ArrayList();
		arrL_retVal = User.search((String)map_search.get("str_user"), str_academia);
		return arrL_retVal;
	}
}